#!/home/rdirbas/mypy/bin/python

import time
import subprocess as sp

def main():
    run_script(choice="1", job_name="unsupervised", memory=100000, cpus=1)


def run_script(choice, job_name, memory=100000, cpus=1):
    job_name = job_name
    memory = str(memory) + "M"
    processors = str(cpus)
    command = "/home/rdirbas/mypy/bin/python /home/rdirbas/Graph/Graph/runs/0.py " + choice

    job_string = """#!/bin/bash
#$ -cwd
#$ -S /bin/bash
#$ -N %s
#$ -o ./%s.out
#$ -e ./%s.err
#$ -M rakan.dirbas@uni-konstanz.de
#$ -m abe
#$ -l mem_free=%s
#$ -pe simple %s
%s""" % (job_name, job_name,  job_name, memory, processors, command)

    p = sp.Popen("qsub", stdout=sp.PIPE, stdin=sp.PIPE, shell=True)
    (output, err) = p.communicate(job_string)
    print output ,"\n\n", err
    time.sleep(0.5)












    